<?php
use WoXuanWang\User\Models\User;
use WoXuanWang\Company\Models\Company;
use WoXuanWang\Customer\Models\Customer;
use WoXuanWang\DataHistory\Models\DataHistory;
use WoXuanWang\DeviceType\Models\DeviceType;
use WoXuanWang\MonitorMethod\Models\MonitorMethod;
use WoXuanWang\Point\Models\Point;
use WoXuanWang\Device\Models\Device;
use WoXuanWang\Solution\Models\Solution;
use WoXuanWang\Project\Models\Project;
use WoXuanWang\Organization\Models\Organization;
use WoXuanWang\Supervisor\Models\Supervisor;
use WoXuanWang\DataType\Models\DataType;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(App\User::class, function (Faker\Generator $faker) {
    static $password;

    return [
        'name'           => $faker->name,
        'email'          => $faker->unique()->safeEmail,
        'password'       => $password ?: $password = bcrypt('secret'),
        'remember_token' => str_random(10),
    ];
});

$factory->define(User::class, function (Faker\Generator $faker) {
    static $password;

    return [
        'name'     => $faker->name,
        'email'    => $faker->unique()->safeEmail,
        'password' => $password ?: $password = bcrypt('secret'),
    ];
});

$factory->define(Company::class, function (Faker\Generator $faker) {
    return [
        'name'    => $faker->company,
        'summary' => $faker->sentence,
    ];
});

$factory->define(Customer::class, function (Faker\Generator $faker) {
    return [
        'job_title' => $faker->jobTitle,
        'name'      => $faker->name
    ];
});

$factory->define(DataHistory::class, function () {
    return [
        'source_data_1' => rand(0, 1000),
        'source_data_2' => rand(0, 1000),
        'source_data_3' => rand(0, 1000),
        'source_data_4' => rand(0, 1000),
        'source_data_5' => rand(0, 1000),
        'source_data_6' => rand(0, 1000),
        'final_data_1'  => rand(0, 1000),
        'final_data_2'  => rand(0, 1000),
        'final_data_3'  => rand(0, 1000),
        'final_data_4'  => rand(0, 1000),
        'final_data_5'  => rand(0, 1000),
        'final_data_6'  => rand(0, 1000),
    ];
});

$factory->define(DeviceType::class, function (Faker\Generator $faker) {
    return [
        'name'  => $faker->name,
        'model' => str_random(10)
    ];
});
$factory->define(MonitorMethod::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name
    ];
});
$factory->define(Point::class, function (Faker\Generator $faker) {
    return [
        'serial_number' => $faker->numberBetween(0, 2147483647)
    ];
});
$factory->define(Device::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'sn'   => $faker->numberBetween(0, 2147483647)
    ];
});
$factory->define(Solution::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'type' => str_random(5)
    ];
});
$factory->define(Project::class, function (Faker\Generator $faker) {
    return [
        'name'      => $faker->name,
        'type'      => str_random(5),
        'longitude' => $faker->longitude,
        'latitude'  => $faker->latitude
    ];
});
$factory->define(Organization::class, function (Faker\Generator $faker) {
    return [
        'name'     => $faker->name,
        'area_id'  => $faker->countryCode,
        'built_at' => $faker->dateTime
    ];
});
$factory->define(Supervisor::class, function (Faker\Generator $faker) {
    return [
        'name'               => $faker->name,
        'professional_title' => $faker->name,
        'job_title'          => $faker->jobTitle
//        'education' => $faker->,
    ];
});
$factory->define(DataType::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name
    ];
});

